package com.guigu.dispatch.feign;

import com.guigu.tms.result.R;
import com.guigu.work.dto.DriverJobDTO;
import com.guigu.work.dto.TaskPickupDispatchDTO;
import com.guigu.work.dto.TaskTransportDTO;
import com.guigu.work.entity.TaskPickupDispatch;
import com.guigu.work.entity.TransportOrder;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName:WorkFeign
 * @Description://TODO
 * @Author:taoLong
 * @Date:2021/11/19:16:10 星期五
 * @email:2391611102@qq.com or 2391611102qq@gmail.com
 */
@FeignClient(value = "tms-work")
public interface WorkFeign {

    /**
     * 新增取派件任务
     *
     * @param dto 取派件任务信息
     * @return 存储结果
     */
    @ApiOperation(value = "新增取派件任务", notes = "基本属性无ID")
    @PostMapping("/task-pickup-dispatch/save")
    public R save(@RequestBody TaskPickupDispatchDTO dto);

    /**
     * 根据订单id获取取派件任务信息
     *
     * @param orderId 订单Id
     * @return 任务详情
     */
    @GetMapping("/task-pickup-dispatch/orderId/{orderId}/{taskType}")
    public R<TaskPickupDispatch> findByOrderId(@PathVariable("orderId") String orderId, @PathVariable("taskType") Integer taskType);

    /**
     * 修改取派件任务信息
     *
     * @param dto 取派件任务信息
     * @return 取派件任务信息
     */
    @ApiOperation(value = "修改取派件任务信息", notes = "基本属性有ID")
    @PutMapping("/task-pickup-dispatch/")
    public R updateById(@RequestBody TaskPickupDispatchDTO dto);


    /**
     * 新增运输任务
     *
     * @param dto 运输任务信息
     * @return 运输任务信息
     */
    @PostMapping("/task-transport/save")
    public R<TaskTransportDTO> save(@RequestBody TaskTransportDTO dto);

    /**
     * 将运单改为已装车和已调度状态
     *
     * @param orderId
     * @return
     */
    @GetMapping("/transport-order/modifyStatusDispatch/{orderId}")
    public R<TransportOrder> modifyStatusDispatch(@PathVariable("orderId") String orderId);

    /**
     * 将运单改为未匹配线路状态
     *
     * @param orderId
     * @return
     */
    @GetMapping("/transport-order/modifyStatusNotMatched/{orderId}")
    public R<TransportOrder> modifyStatusNotMatched(@PathVariable("orderId") String orderId);


    /**
     * 根据订单id获取运单信息
     *
     * @param orderId 订单id
     * @return 运单信息
     */
    @ApiOperation(value = "根据订单id获取运单信息", notes = "订单id")
    @GetMapping("/transport-order/{orderId}")
    public R<TransportOrder> findByOrderId(@PathVariable(name = "orderId") String orderId);


    /**
     * 修改运输任务信息
     *
     * @param dto 运输任务信息
     * @return 运输任务信息
     */
    @ApiOperation(value = "修改运输任务信息", notes = "带ID")
    @PutMapping("/task-transport/")
    public TaskTransportDTO updateById(@RequestBody TaskTransportDTO dto);

    /**
     * 新增司机作业单
     *
     * @param dto 司机作业单信息
     * @return 司机作业单信息
     */
    @ApiOperation("新增司机作业单")
    @PostMapping("/driver-job/save")
    public R save(@RequestBody DriverJobDTO dto);
}
